/*Author : Rozi Kapara Dista*/

package jtk.project4.fleet.screen.editScheduleRepair;

import java.awt.FlowLayout;
import java.util.List;

//import jtk.project4.fleet.event.AdvancedOptionsEvent;
//import jtk.project4.fleet.field.AdvancedOptionsField;
import jtk.project4.fleet.field.DriverLicenseInformationField;
import jtk.project4.fleet.field.EditScheduleRepairField;
import jtk.project4.fleet.field.GeneralInformationField;
import jtk.project4.fleet.field.MicellaneousField;
import jtk.project4.fleet.field.PersonnelInformationField;
import jtk.project4.fleet.field.RepairTableField;
//import jtk.project4.fleet.field.TaskTerminationField;
//import jtk.project4.fleet.field.SeasonalTrackingField;


import nl.coderight.jazz.form.FormHeader;
import nl.coderight.jazz.form.FormLayout;
import nl.coderight.jazz.form.FormView;
import nl.coderight.jazz.form.control.GroupControl;
import nl.coderight.jazz.form.field.button.PushButton;


public class EditScheduleRepairView extends FormView{
	private FormHeader formHeader;
	private PushButton submitButton;
	private PushButton cancelButton;
	private PushButton helpButton;
	private PushButton addButton;
	private PushButton editButton;
	private PushButton deleteButton;
	
	@Override
	protected void init() {
		createFields();
		createLayout();		
	}	
	
	
	private void createFields(){
		submitButton = new PushButton("Save");
		cancelButton = new PushButton("Cancel");
		helpButton = new PushButton("Help");
		addButton = new PushButton("Add");
		editButton = new PushButton("Edit");
		deleteButton = new PushButton("Delete");
	}
	
	private void createLayout() {
		setHeader(createHeader());
		addField(createForm());
	}
	
	private FormHeader createHeader() {
		formHeader = new FormHeader();
		formHeader.setTitle("editScheduleRepair.header.form");
		return formHeader;
	}
	
	private GroupControl createForm() {
		GroupControl form = new GroupControl();
		form.addField(new EditScheduleRepairField("EditScheduleRepair"), NORTH);
		form.addField(new RepairTableField("RepairTable"), CENTER);
		//form.addField(new AdvancedOptionsField("AdvancedOptions"), NORTH);
		//form.addField(createGeneralTab(), CENTER);
		form.addField(createButtons3(), SOUTH);		
		return form;
	}
	
	private GroupControl createButtons() {
		GroupControl buttons = new GroupControl();
		buttons.setLayout(new FlowLayout(FlowLayout.RIGHT));
		buttons.addField(submitButton);
		buttons.addField(cancelButton);
		buttons.addField(helpButton);
		return buttons;
	}
	
	private GroupControl createButtons2() {
		GroupControl buttons = new GroupControl();
		buttons.setLayout(new FlowLayout(FlowLayout.LEFT));
		buttons.addField(addButton);
		buttons.addField(editButton);
		buttons.addField(deleteButton);
		return buttons;
	}
	
	private GroupControl createButtons3() {
		GroupControl form = new GroupControl();
		form.addField(createButtons2(), NORTH);
		form.addLabel("When due, schedule repairs will be printed on maintenance due reports or can be automatically populated to a work order", CENTER);
		form.addField(createButtons(), SOUTH);
		return form;
	}	

	

}
